<%--
  Created by IntelliJ IDEA.
  User: 18306
  Date: 2020/11/2
  Time: 16:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<% String path = request.getContextPath(); %>
<!DOCTYPE HTML>
<html>
<head>
    <script id="allmobilize" charset="utf-8" src="/static/js/allmobilize.min.js"></script>
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="alternate" media="handheld"  />
    <!-- end 云适配 -->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>注册-拉勾网-最专业的互联网招聘平台</title>
    <meta property="qc:admins" content="23635710066417756375" />
    <meta content="拉勾网是3W旗下的互联网领域垂直招聘网站,互联网职业机会尽在拉勾网" name="description">
    <meta content="拉勾,拉勾网,拉勾招聘,拉钩, 拉钩网 ,互联网招聘,拉勾互联网招聘, 移动互联网招聘, 垂直互联网招聘, 微信招聘, 微博招聘, 拉勾官网, 拉勾百科,跳槽, 高薪职位, 互联网圈子, IT招聘, 职场招聘, 猎头招聘,O2O招聘, LBS招聘, 社交招聘, 校园招聘, 校招,社会招聘,社招" name="keywords">

    <meta name="baidu-site-verification" content="QIQ6KC1oZ6" />

    <!-- <div class="web_root"  static="display:none">h</div> -->
    <script type="text/javascript">
        var ctx = "h";
        console.log(1);
    </script>
    <link rel="Shortcut Icon" href="/static/images/favicon.ico">
    <link rel="stylesheet" type="text/css" href="/static/css/style.css"/>

    <script src="/static/js/jquery.1.10.1.min.js" type="text/javascript"></script>

    <script type="text/javascript" src="/static/js/jquery.lib.min.js"></script>
    <script type="text/javascript" src="/static/js/core.min.js"></script>


    <script type="text/javascript">
        var youdao_conv_id = 271546;
    </script>
    <script type="text/javascript" src="/static/js/conv.js"></script>
</head>

<body id="login_bg">
<div class="login_wrapper">
    <div class="login_header">
        <a href="h/"><img src="/static/images/logo_white.png" width="285" height="62" alt="拉勾招聘" /></a>
        <div id="cloud_s"><img src="/static/images/cloud_s.png" width="81" height="52" alt="cloud" /></div>
        <div id="cloud_m"><img src="/static/images/cloud_m.png" width="136" height="95"  alt="cloud" /></div>
    </div>

    <input type="hidden" id="resubmitToken" value="9b207beb1e014a93bc852b7ba450db27" />
    <div class="login_box">
        <form id="loginForm" method="post" >
            <ul class="register_radio clearfix">
                <li value="0" id="findJob">
                    找工作
                    <input type="radio" value="0" name="type" />
                </li>
                <li id="find" value="0">
                    招人
                    <input type="radio" value="1" name="type" />
                </li>
            </ul>
            <c:set var="referer" value="${empty(param.referer)?header.referer:param.referer}"></c:set>
            <input type="hidden" name="referer" value="${empty(requestScope.referer)?header.referer:requestScope.referer}">
            <span class="error" style="display:none;" id="selectError">请先选择</span>
            <input type="text" id="userPhone" name="userPhone" tabindex="1" placeholder="请输入手机号" />
            <span class="error" style="display:none;" id="userPhoneError">请输入正确格式的手机号</span>
            <input type="password" id="password" name="userPass" tabindex="2" placeholder="请输入密码" />
            <span class="error" style="display:none;" id="passwordError">密码必须是数字与字母组合</span>
            <input type="password" id="confimpassword"  tabindex="2" placeholder="请确认密码" />
            <span class="error" style="display:none;" id="confimpasswordError">两次输入的密码不一致</span>
            <input  type="text" id="code" name="code" tabindex="2" placeholder="请输入验证码" />
            <input type="button"  class="getcode" id="getCode" value="获取验证码"></input>
            <span class="error" style="display:none;" id="codeError">验证码错误</span>
<%--            <label class="fl registerJianJu" for="checkbox">--%>
<%--                <input type="checkbox" id="checkbox" name="checkbox" checked  class="checkbox valid" />我已阅读并同意<a href="h/privacy.html" target="_blank">《拉勾用户协议》</a>--%>
<%--            </label>--%>
            <input type="button" id="submitLogin" value="注 &nbsp; &nbsp; 册" />

            <input type="hidden" id="callback" name="callback" value=""/>
            <input type="hidden" id="authType" name="authType" value=""/>
            <input type="hidden" id="signature" name="signature" value=""/>
            <input type="hidden" id="timestamp" name="timestamp" value=""/>
        </form>
        <div class="login_right">
            <div>已有拉勾帐号</div>
            <a  href="/bossmanage/login"  class="registor_now">直接登录</a>
            <div class="login_others">使用以下帐号直接登录:</div>
            <a  href="h/ologin/auth/sina.html"  target="_blank" class="icon_wb" title="使用新浪微博帐号登录"></a>
            <a  href="h/ologin/auth/qq.html"  class="icon_qq" target="_blank" title="使用腾讯QQ帐号登录" ></a>
        </div>
    </div>
    <div class="login_box_btm"></div>
</div>
<script type="text/javascript">
    //页面加载完执行该函数
    $(function(){
        $('.register_radio li input').click(function(e){
            $(this).parent('li').addClass('current').append('<em></em>').siblings().removeClass('current').find('em').remove();

        });

        //判定电话号码是否是国内的电话号码
        $("#userPhone").blur(checkUserPhone);
        function checkUserPhone(){
            var userPhone = $("#userPhone").val();
            var regExp = /^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/;
            if(regExp.test(userPhone)){
                $("#userPhoneError").css("display","none");
                return true;
            }else {
               // if(userPhone==""){
               //     $("#userPhoneError").css("display","block");
               //     return false;
               // }else{
                   $("#userPhoneError").css("display","block");
                   return false;
               // }
            }
        }
        //判断密码是否符合规范
        $("#password").blur(checkPassword);
        function checkPassword() {
            var userpass = $("#password").val();
            var regExp = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{7,11}$/;
            if(regExp.test(userpass)){
                $("#passwordError").css("display","none");
                return true;
            }else {
                $("#passwordError").css("display","block");
                return false;
            }
        }
        //判断两次密码是否输入一致
        $("#confimpassword").blur(confirmPassword);
        function  confirmPassword() {
            if($("#password").val()==$("#confimpassword").val()){
                $("#confimpasswordError").css("display","none");
                return true;
            }else {
                $("#confimpasswordError").css("display","block");
                return false;
            }
        }
        //修改验证码提示信息
        $("#code").blur(updateError);
        function updateError(){
            $("#codeError").css("display","none");
        }
        //验证码为空时不提交表单
        function codeNull(){
            if($("#code").val()==""){
                $("#codeError").css("display","block");
                $("#codeError").html("请点击发送或者输入验证码");
                return false;
            }
        }
        //获取手机验证码
        $("#getCode").click(function () {
            $("#codeError").css("display","none");
            var userPhone = $("#userPhone").val();
            var regExp = /^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/;;
            if(regExp.test(userPhone)){
                $.ajax({
                    url:"/bossmanage/getCode",
                    type:"get",
                    async:false,
                    data:"userPhone="+userPhone,
                });
            }else {
                $("#userPhoneError").css("display","block");
            }
                settime(this);
        })
        //控制时间的函数
        var countdown=60;        //初始值
        function settime(val) {

            if (countdown == 0) {
                val.removeAttribute("disabled");
                val.value="获取验证码";
                countdown = 60;
                return false;
            } else {
                val.setAttribute("disabled", true);

                val.value="重新发送(" + countdown + ")";
                countdown--;
            }
            setTimeout(function() {   //设置一个定时器，每秒刷新一次
                settime(val);
            },1000);
        }
        //选找工作
        $("#findJob").click(function () {
            $("#findJob").attr("value",1);
            $("#find").attr("value",0);
            $("#selectError").css("display","none");
        })
        //选找人
        $("#find").click(function () {
            $("#findJob").attr("value",0);
            $("#find").attr("value",1);
            $("#selectError").css("display","none");
        })
        //表单提交
        $("#submitLogin").click(function () {
            //判定是老板还是招聘者  为什么path要加/才能行
            var path = "/";
            if($("#findJob").attr("value")==1&&$("#find").attr("value")==0){
                path = "/manage/regist"
            }
            if($("#findJob").attr("value")==0&&$("#find").attr("value")==1){
                path = "/bossmanage/regist";
            }
            //如果没有选定老板和招聘者 先选定
            if($("#findJob").attr("value")==0&&$("#find").attr("value")==0){
                $("#selectError").css("display","block");
                return;
            }
            if(checkUserPhone()==false){
                return;
            }
            if(checkPassword()==false){
                return;
            }
            if(confirmPassword()==false){
                return;
            }
            if(codeNull()==false){
                return;
            }
            $.ajax({
                type:"post",
                url:path,
                data: $('#loginForm').serialize(),
                success:function (mes) {
                    if(mes=="hasPhone"){
                        $("#userPhoneError").css("display","block");
                        $("#userPhoneError").html("该用户已经注册");
                        return;
                    }
                    if(mes=="differentCode"){
                        $("#codeError").css("display","block");
                        $("#codeError").html("验证码错误");
                        return;
                    } if(mes=="getCode"){
                        $("#codeError").css("display","block");
                        $("#codeError").html("请点击发送验证码");
                        return;
                    }
                    if(mes=="success"){
                        window.location.href = "/bossmanage/addcompanyinfo1";
                        return;
                    }

                    window.location.href = mes;
                }

            });


        })



    })
</script>


</body>
</html>
